

/*---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
---------------------------------------------------------*/
function EFFECT:Init( data )
	
	self.Ent = data:GetEntity()
	self.Sc = data:GetScale() //1 or 2 is the scale
	self.Size = math.random(20,30)
	
	if self.Ent:IsValid() then
		self.Emitter = ParticleEmitter( self.Ent:GetPos() )
	else
		self.Ent = nil
	end
end

/*---------------------------------------------------------
   THINK
   Returning false makes the entity die
---------------------------------------------------------*/
function EFFECT:Think( )
	if self.Ent == nil then return false end
	if not self.Ent:IsValid() then self.Emitter:Finish() return false end
	self.Size = math.random(9,15) * self.Sc
	
	for i=1,math.random(1,2) do
	
		local particle = self.Emitter:Add("effects/muzzleflash"..math.random(1,4), self.Ent:GetPos())
	
		particle:SetVelocity(Vector(math.Rand(-3,3),math.Rand(-3,3),math.Rand(1,10)))
		particle:SetDieTime( math.Rand(.5,1) )
		particle:SetStartAlpha( math.Rand( 130, 150 ) )
		particle:SetEndAlpha(1)
		particle:SetStartSize( self.Size )
		particle:SetEndSize( 0 )
		particle:SetRoll( math.Rand( -95, 95 ) )
		particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
		particle:SetColor( math.Rand( 150, 255 ), math.Rand( 120, 150 ), 100 )
		
	end
	
	return true
end


/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render()

end
